package com.cskaoyan.shopping.converter;

import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dto.SearchProductDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface SearchProductConverter {

    @Mappings({
            @Mapping(source = "id", target = "productId"),
            @Mapping(source = "title", target = "productName"),
            @Mapping(source = "sell_point",target = "subTitle"),
            @Mapping(source = "price",target = "salePrice"),
            @Mapping(source = "image",target = "picUrl")
    })
    SearchProductDto item2SearchProductDto(Item item);


    List<SearchProductDto> items2SearchProductDtos(List<Item> items);
}
